package com.example.Service;
import com.example.Dao.NewsDao;
import com.example.pojo.News;
import java.util.List;
public class NewsService {
  NewsDao newsDao =new NewsDao();
  public List<News> getNewByType(String type){
      List<News> list =newsDao.getNewByType(type);
      return list ;
  }
  public int addNews(News news){
      return newsDao.addNews(news);
  }
  public int delNews(int id){
      return newsDao.deleteNews(id);
  }
  public int delBatchNews(List<Integer> list){
        return newsDao.deleteBatchNews(list);
    }
//  public int updateNews(int id){
//      return newsDao.updateNews(id);
//  }
  //获取总行数
    public int getTotal(){
      return newsDao.getTotal();
    }
  public List<News> getAllNews(int currentPage,int pageSize){
      return  newsDao.getAllNews(currentPage, pageSize);
  }
    public List<News> getTrendingNews(){
        return  newsDao.getTrendingNews();
    }
  public News getNewsById(int id){
    News n= newsDao.getNewsInfo(id);
    return  n;
  }
}
